import java.util.List;

public class K_6 {
    static public void hanota(List<Integer> A, List<Integer> B, List<Integer> C) {
        movePlate(A.size(), A, B, C);
    }
    static void movePlate(int num, List<Integer> original, List<Integer> auxiliary, List<Integer> target) {
        if (num == 1) {
            target.add(original.remove(original.size() - 1));
            return;
        }
        movePlate(num - 1, original, target, auxiliary);
        target.add(original.remove(original.size() - 1));
        movePlate(num - 1, auxiliary, original, target);
    }
}
